package lib

func init() {
	Probs = append(Probs, Problem{
		Num:         27,
		Discription: "原地移除数组中指定元素的值",
		Level:       1,
		Labels: map[string]int{
			"快慢指针": 1,
			"双指针滑动": 1,
		},
	})
}

func RemoveElement(nums []int, val int) int {
	slow := 0
	for fast := 0; fast < len(nums); fast++ {
		if nums[fast] != val {
			nums[slow] = nums[fast]
			slow++
		}
	}

	return slow
}
